<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <input type="button" value="修改msg" @click="setMsg"/>
        <input type="text" v-model="msg" @keyup.enter="getMsg"/>
        <h2>{{msg}}</h2>
    </div>
    <script src="../../js/vue.js"></script>
    <script>
        var vue = new Vue({
            el: '#app',
            data: {
                msg: '你好'
            },
            methods: {
                setMsg: function() {
                    this.msg = 'hello';
                },
                getMsg: function() {
                    alert(this.msg);
                }
            },
        });
    </script>
</body>
</html>